package Inner;

public class Test {
    //获取实例内部类对象
    OuterClass outerClass = new OuterClass();
    OuterClass.InnerClass innerClass = outerClass.new InnerClass();
}

class Test1 {
    //获取实例内部类对象
    OuterClass.InnerClass innerClass = new OuterClass().new InnerClass();
}

class OuterClass {
    public int date1 = 1;
    int date2 = 2;
    public static int date3 = 3;

    //实例内部类
    public class InnerClass {
        int date1 = 11;
        int date4 = 4;
        public int date5 = 5;
        private int c;
//        public static int d; //erro
//        public static void func() {
//            System.out.prnitln("1");
//    }
        public static final int date6 = 6; //常量

        public void func() {
            System.out.println(OuterClass.this.date1);//实例内部类当中访问外部类相同的成员变量 OuterClass.this.变量
            System.out.println(date1);
            System.out.println(date2);
            System.out.println(date3);
            System.out.println(date4);
            System.out.println(date5);
            System.out.println(date6);
        }
    }
    public void test() {
        InnerClass innerClass = new InnerClass();
        innerClass.func();
    }
    public void test1() {
        InnerClass innerClass1 = new InnerClass();
        innerClass1.func();
    }
}
class test2 {
    public static void main(String[] args) {
        OuterClass outerClass = new OuterClass();
        OuterClass.InnerClass innerClass = outerClass.new InnerClass();
        innerClass.func();
    }
}